
function createPoint(name, spot, outPut, inPut) {
    return $(go.Shape, "Circle", {
        fill: "rgba(0,0,0,0)",//填充颜色
        stroke: null,
        desiredSize: new go.Size(24, 24),//设定尺寸
        alignment: spot,//指定点的位置  go.Spot.top/go.Spot.left/go.Spot.bottom/go.Spot.right
        alignmentFocus: spot,//焦点对应的位置
        portId: name,
        fromSpot: spot, toSpot: spot,//from 从哪里来的 to  到哪里去的
        fromLinkable: outPut, toLinkable: inPut,//from 点 是否可以连  to  点 是否可连
        cursor: 'pointer'//手势
    })
}
function nodeStyle() {
    return [
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        {
            mouseEnter: function (e, obj) {
                showPorts(obj.part, true);
            },
            mouseLeave: function (e, obj) {
                showPorts(obj.part, true);
            },
            locationObjectName: "TOOL",//标记属于localtion节点对象的name
            selectionObjectName: "TOOL",//标记能够被选中的节点对象的name
//                resizable: true,//允许改变尺寸
//                resizeObjectName: "TOOL",//允许改变的节点name
            rotatable: true,//允许旋转
        }
    ]
}
function showPorts(node, show) {//显示可连接的点
    var diagram = node.diagram;
    //判断是否有diagram 是否可读  是否能连线
    if (!diagram || diagram.isReadOnly || !diagram.allowLink) return;
    node.ports.each(function (port) {
        port.stroke = (show ? "#fff" : null);
        port.fill = (show ? "green" : null);
    });
}


function DXDLJHQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t", new go.Spot(0.31, 0.1), false, true),
        createPoint("bottom", new go.Spot(0.31, 1), true, false)
    )
}
function DRKG() {
    return $(go.Node, "Auto", nodeStyle(),
        $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.51, 0), false, true),
        createPoint("bottom",  new go.Spot(0.51, 1), true, false)
    )
}
function LRZDYBYQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function JDBLQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.2, 0), false, true)

    )
}
function FHKG() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.6, 0), false, true)
    )
}
function DKQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function SJXBYQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function DRQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function JCQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function XSJXBYQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function JDX() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true)
    )
}
function BLQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function DLQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function CTSDLQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function DDXSQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function DYBYQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function RJDQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.4, 0), false, true),
        createPoint("bottom", new go.Spot(0.4, 1), true, false)
    )
}
function SC() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), true, false)
    )
}

function SDYQHKG() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("LT",  new go.Spot(0.175, 0), false, true),
        createPoint("RT", new go.Spot(0.73, 0), true, false),
    createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function DTDLHGQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function GLKG() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.49, 0), false, true),
        createPoint("bottom", new go.Spot(0.49, 1), true, false)
    )
}
function XXBYQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function DLHGQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.455, 0), false, true),
        createPoint("bottom", new go.Spot(0.455, 1), true, false)
    )
}
function DYHGQ() {
    return $(go.Node, "Auto", nodeStyle(),
            $(go.Shape, "Rectangle",
            {name: "SHAPE", fill: "rgba(0,0,0,0)", stroke: null}),
        $(go.Panel, "Horizontal",
            $(go.Picture, {margin: 10, name: "TOOL"}, new go.Binding('source', "img")),
            $(go.TextBlock, {
                editable: false,
                stroke: "white",
                font: "32pt Verdana, sans-serif",
                isMultiline: true,
                name: "TEXT"
            }, new go.Binding("text", "name").makeTwoWay())
        ),
        createPoint("t",  new go.Spot(0.46, 0), false, true),
        createPoint("bottom", new go.Spot(0.46, 1), true, false)
    )
}